//
//  MRCustomNotificationsCutHeadView.m
//  MoRan
//
//  Created by MoRan  on 2023.
//  Copyright © 2023 MoRan . All rights reserved.
//

#import "MRCustomNotificationsCutHeadView.h"

@implementation MRCustomNotificationsCutHeadView

+ (id)instanceView {
    NSArray* nibView =  [[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:self options:nil];
    return [nibView objectAtIndex:0];
}

- (void)awakeFromNib {
    // Initialization code
    [super awakeFromNib];
    _leftButton.adjustsImageWhenHighlighted = NO;
    _rightButton.adjustsImageWhenHighlighted = NO;
}

- (void)setIndex:(NSInteger)index {
    [_leftButton setTitle:@"  进行中" forState:UIControlStateNormal];
    [_rightButton setTitle:@"  已完成" forState:UIControlStateNormal];
    if (index == 0) {
        [_leftButton setImage:[UIImage imageNamed:@"jx_select"] forState:UIControlStateNormal];
        [_leftButton setTitleColor:UIColorFromHex(0x008EFF) forState:UIControlStateNormal];
        
        [_rightButton setImage:[UIImage imageNamed:@"ywc_unselect"] forState:UIControlStateNormal];
        [_rightButton setTitleColor:UIColorFromHexA(0x000000,0.3) forState:UIControlStateNormal];
    } else {
        [_leftButton setImage:[UIImage imageNamed:@"jx_unselect"] forState:UIControlStateNormal];
        [_leftButton setTitleColor:UIColorFromHexA(0x000000,0.3) forState:UIControlStateNormal];
        
        [_rightButton setImage:[UIImage imageNamed:@"ywc_select"] forState:UIControlStateNormal];
        [_rightButton setTitleColor:UIColorFromHex(0x008EFF) forState:UIControlStateNormal];
    }
}

- (IBAction)buttonAction:(UIButton *)sender {
    if (_buttonAction) {
        _buttonAction(self,sender);
    }
}

@end
